<template>
  <div id='box'> 
      <!-- 公共的轮播图组件 -->

      <div class="container">
              <div class="swiper-wrapper">
                    <div class="swiper-slide">
                        <slot name="img1"> </slot>
                    </div>
                    <div class="swiper-slide">
                        <slot name="img2"> </slot>
                    </div>
                    <div class="swiper-slide">
                        <slot name="img3"> </slot>
                    </div>
              </div>
                <!-- 如果需要分页器 -->
                <div class="swiper-pagination"></div>
      </div>
      <div>
          <div>
               <p> 猜你喜欢</p>  
            <ul>
                <li class="list_img" v-for="(item,index) in body_pic" :key="index" :mysrc="item">
                <img :src="item.imgUrl">
                </li>
                <li class=" zhushi" v-for="(item,index) in vul" :key="index" :mysrc="item">
                    <p>{{item.itemName}}</p>
                    <p>票价 ：￥{{item.minPrice}}元起</p>
                </li>
            </ul>
          </div>
           <div class="abc">
                    <p> 精彩聚集 </p>
                <li class="next_pic" v-for="(item,index) in next_pic" :key="index" :mysrc="item">
                    <img :src="item.imgUrl">
                </li>
           </div>
  
           <div>
               <li class="next2_pic" v-for="(item,index) in next2_pic" :key="index" :mysrc="item">
                    <img :src="item.imgUrl">
                </li>
           </div>
           <el-tabs type="border-card">
                <el-tab-pane class="open" label="全年龄段">
                    <li class="erji" v-for="(item,index) in erji" :key="index" :mysrc="item">
                      <img :src="item.imgUrl">
                    <h4  v-for="(item,index) in youcewenzi" :key="index" :mysrc="item">
                          <p> {{item.itemName}} <br><br><br></p>
                          <p> {{item.startTime}}</p>
                          <p> {{item.itemType2Name}}</p>
                          <p>票价：￥{{item.minPrice}} 元起</p>
                    </h4>
               </li>
                </el-tab-pane>
                <el-tab-pane label="0—3岁">
                                        <li class="erji" v-for="(item,index) in erji" :key="index" :mysrc="item">
                      <img :src="item.imgUrl">
                    <h4  v-for="(item,index) in youcewenzi" :key="index" :mysrc="item">
                          <p> {{item.itemName}} <br><br><br></p>
                          <p> {{item.startTime}}</p>
                          <p> {{item.itemType2Name}}</p>
                          <p>票价：￥{{item.minPrice}} 元起</p>
                    </h4>
               </li>
                </el-tab-pane>
                <el-tab-pane label="3—6岁">
                                        <li class="erji" v-for="(item,index) in erji" :key="index" :mysrc="item">
                      <img :src="item.imgUrl">
                    <h4  v-for="(item,index) in youcewenzi" :key="index" :mysrc="item">
                          <p> {{item.itemName}} <br><br><br></p>
                          <p> {{item.startTime}}</p>
                          <p> {{item.itemType2Name}}</p>
                          <p>票价：￥{{item.minPrice}} 元起</p>
                    </h4>
               </li>
                </el-tab-pane>
                <el-tab-pane label="6—12岁">
                                        <li class="erji" v-for="(item,index) in erji" :key="index" :mysrc="item">
                      <img :src="item.imgUrl">
                    <h4  v-for="(item,index) in youcewenzi" :key="index" :mysrc="item">
                          <p> {{item.itemName}} <br><br><br></p>
                          <p> {{item.startTime}}</p>
                          <p> {{item.itemType2Name}}</p>
                          <p>票价：￥{{item.minPrice}} 元起</p>
                    </h4>
               </li>
                </el-tab-pane>
            </el-tabs>
             <p>热门排行</p>
            <div class="paihang">
              <img class="zuo" src="../assets/dm_img/left.jpg">
                <li class="erji" v-for="(item,index) in erji" :key="index" :mysrc="item">
                    <img :src="item.imgUrl">
                    <h4  v-for="(item,index) in youcewenzi" :key="index" :mysrc="item">
                          <p> {{item.itemName}} <br><br><br></p>
                          <p> {{item.startTime}}</p>
                          <p> {{item.itemType2Name}}</p>
                          <p>票价：￥{{item.minPrice}} 元起</p>
                    </h4>
               </li>
            </div>
               
      </div>
        
  </div>
</template>


<script>
import Swiper from "swiper";
export default {
  name: "banner",
  data() {
    return {
      body_pic: [],
      vul: [],
      next_pic: [],
      next2_pic: [],
      erji: [],
      youcewenzi: [],
      zuihou: []
    };
  },
  methods: {
    getimg() {
      this.$http.get("http://localhost:8082/imgUrl_wudao").then(res => {
        let arr = [];
        for (let i = 0; i < res.data.length; i++) {
          let arr = res.data[i];
          this.body_pic.push(arr);
        }
      });
    },
    getval() {
      this.$http.get("http://localhost:8082/vul_wudao").then(res => {
        console.log(res.data);
        this.vul = res.data;
      });
    },
    getpic() {
      this.$http.get("http://localhost:8082/next_pic_wudao").then(res => {
        let price = [];
        for (let i = 0; i < res.data.length; i++) {
          let arr = res.data[i];
          this.next_pic.push(arr);
        }
        console.log(res.data.length);
      });
    },
    sange() {
      this.$http.get("http://localhost:8082/next2_pic_wudao").then(res => {
        let price = [];
        for (let i = 0; i < res.data.length; i++) {
          let arr = res.data[i];
          this.next2_pic.push(arr);
        }
        console.log(res.data.length);
      });
    },
    ppp() {
      this.$http.get("http://localhost:8082/erji_wudao").then(res => {
        let erji = [];
        for (let i = 0; i < res.data.length; i++) {
          let erji = res.data[i];
          this.erji.push(erji);
        }
        console.log(res.data.length);
      });
    },
    fenlei() {
      this.$http.get("http://localhost:8082/youce_wudao").then(res => {
        let youcewenzi = [];
        for (let i = 0; i < res.data.length; i++) {
          let youce = res.data[i];
          this.youcewenzi.push(youce);
        }
        console.log(res.data.length);
      });
    },
    paihang() {
      this.$http.get("http://localhost:8082/last_wudao").then(res => {
        let zuihou = [];
        for (let i = 0; i < res.data.length; i++) {
          let zuihou = res.data[i];
          this.zuihou.push(zuihou);
        }
        console.log(res.data.length);
      });
    }
  },
  components: {},
  mounted() {
    this.getimg();
    this.getval();
    this.getpic();
    this.sange();
    this.sange();
    this.sange();
    this.ppp();
    this.fenlei();
    this.paihang();
    var swiper = new Swiper(".container", {
      //   autoplay: true, //可选选项，自动滑动
      direction: "horizontal",
      loop: "loop",
      effect: "fade",
      pagination: {
        // 如果需要分页器
        el: ".swiper-pagination"
      }
    });
  }
};
</script>

<style src="swiper/dist/css/swiper.min.css"></style>

<style scoped>
#box {
  margin: 0% auto;
  width: 1415px;
}
/* @import "swiper/dist/css/swiper.min.css"; */
.swiper-slide img {
  border: 2px blue solid;
  width: 90%;
  height: 400px;
}
.list_img img {
  width: 150px;
  height: 200px;
  margin: 30px;
}
ul li {
  list-style: none !important;
  display: inline-block;
}
.zhushi {
  /* border: 2px red solid; */
  width: 170px;
  margin-right: 20px;
  margin-left: 20px;
  /*这个单词的意思是强制在一行显示 */
  white-space: nowrap;
  /* 溢出的部分隐藏 */
  overflow: hidden;
  /* 文字溢出的时候用省略号显示 */
  text-overflow: clip;
}
.next_pic {
  list-style: none !important;
  display: inline-block;
}
.next_pic img {
  width: 100%;
  height: 100%;
}
.abc {
  position: relative;
  height: 520px;
}
.abc li:nth-of-type(1) {
  position: absolute;
  left: 70px;
  height: 515px;
  width: 300px;
  /* border: 5px red solid; */
}
.abc li:nth-of-type(2) {
  position: absolute;
  left: 400px;
  overflow: hidden;
  width: 180px;
  height: 250px;
}
.abc li:nth-of-type(3) {
  position: absolute;
  right: 400px;
  overflow: hidden;
  width: 180px;
  height: 250px;
}
.abc li:nth-of-type(4) {
  position: absolute;
  left: 620px;
  overflow: hidden;
  width: 180px;
  height: 250px;
}
.abc li:nth-of-type(5) {
  position: absolute;
  top: 300px;
  left: 400px;
  overflow: hidden;
  width: 180px;
  height: 250px;
}
.abc li:nth-of-type(6) {
  position: absolute;
  top: 300px;
  right: 400px;
  overflow: hidden;
  width: 180px;
  height: 250px;
}
.abc li:nth-of-type(7) {
  position: absolute;
  top: 300px;
  left: 620px;
  overflow: hidden;
  width: 180px;
  height: 250px;
}
.abc li:nth-of-type(8) {
  position: absolute;
  right: 70px;
  height: 515px;
  width: 300px;
  /* border: 5px red solid; */
}
.next2_pic {
  display: inline-block;
  list-style: none;
  margin: 35px;
}
.erji {
  display: inline-block;
  /* border: 1px red solid; */
  list-style: none;
  position: relative;
  padding: 20px;
  width: 30%;
  height: 300px;
}
.erji img {
  position: absolute;
  left: 0;
  display: inline-block;
  list-style: none;
  width: 200px;
  height: 270px;
  text-align: left;
  /* margin-left: -200px; */
  padding-left: 0%;
}
.erji h4 {
  float: right;
  width: 200px;
}
.last {
  position: relative;
  display: inline-block !important;
  list-style: none;
  float: left;
  width: 200px;
  height: 270px;
}
.last img {
  position: absolute;
  width: 100%;
  height: 100%;
}
.paihang{
  position: relative;
}
.paihang li{
  width: 320px;
  float: right;
  
}
.paihang h4{
  width: 150px;
}
.zuo{
  float: left;
  width: 300px;
  height:650px ;
}
</style>

